export default (target) => {
    target.prototype.changeTab = (dom, className) => {
        dom.parent().addClass(className)
            .siblings().removeClass(className);
    }
    target.prototype.getSearchData = (type, data, str) => {
        switch(type) {
            case 'tab':
                return data.filter(item => str === 'all' || item.field === str)
            case 'search':
                return data.filter(item => {
                    let field = item.field.toLowerCase(),
                        slogan = item.slogan.substring(0, 10);
                    if (!str) {
                        return true;
                    }
                    return field.includes(str) || slogan.includes(str);
                })
            default:
                break;
        }
    }
}